/**

This file is part of MaCI/GIMnet.

MaCI/GIMnet is free software: you can redistribute it and/or modify it 
under the terms of the GNU Lesser General Public License as published 
by the Free Software Foundation, either version 3 of the License, or 
(at your option) any later version.

MaCI/GIMnet is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
License for more details.

You should have received a copy of the GNU Lesser General Public 
License along with GIMnet. (See COPYING.LESSER) If not, see 
<http://www.gnu.org/licenses/>.

**/
/*******************************************************************************
    FILE NAME:		defs.h

    PROJECT:		Linux ECAN527/1000 driver, library, and sample programs

    FILE DESCRIPTION:	This header file defines some miscellaneous macros.

    Copyright (c) 2004 RTD Embedded Technologies, Inc.

    For driver version, compiler, and target information, please refer to the
    file README.TXT.
*******************************************************************************/

#ifndef  _ECAN_DEFS_H
# define _ECAN_DEFS_H

# ifndef  NUL
#  define NUL '\0'
# endif


# include <decls.h>


# ifndef  _STRING_
#  define _STRING_(x)	#x
# endif

# ifndef  _STRING
#  define _STRING(x)	_STRING_(x)
# endif



# ifndef  _CONCAT_
#  define _CONCAT_(_1,_2)	_1##_2
# endif

# ifndef  _CONCAT3_
#  define _CONCAT3_(_1,_2,_3)	_1##_2##_3
# endif


# ifndef  _CONCAT
#  define _CONCAT(_1,_2)	_CONCAT_(_1,_2)
# endif

# ifndef  _CONCAT3
#  define _CONCAT3(_1,_2,_3)	_CONCAT3_(_1,_2,_3)
# endif


# ifndef  _UNUSED_
#  define _UNUSED_ __attribute__((unused))
# endif


# ifndef  offsetof
#  define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
# endif


# ifndef DEBUG
#  define ASM_MARK(string)	\
	asm("# " string "\n")

#  define ASM_MARK_BEGIN_FUNCTION	\
	ASM_MARK("Begin " __PRETTY_FUNCTION__)

#  define ASM_MARK_END_FUNCTION	\
	ASM_MARK("End " __PRETTY_FUNCTION__)

# else

#  define ASM_MARK(string)
#  define ASM_MARK_BEGIN_FUNTCION
#  define ASM_MARK_END_FUNCTION
# endif


#endif	/* _ECAN_DEFS_H */
